import request from '@/router/axios'

//分页查询未生成委外订单的配镜单
export function getUnConsignSaleByPage(query) {
  return request({
    url: '/eims/consign/getUnConsignSaleByPage',
    method: 'get',
    params: query
  })
}
//分页查询已生成委外订单列表
export function getConsignByPage(query) {
  return request({
    url: '/eims/consign/getConsignByPage',
    method: 'get',
    params: query
  })
}
//单条获取未生成委外订单的配镜单信息
export function getUnConsignSaleById(saleId) {
  return request({
    url: '/eims/consign/getUnConsignSale/' + saleId,
    method: 'get'
  })
}
//单条获取已生成委外订单的信息
export function getConsignSaleById(id) {
  return request({
    url: '/eims/consign/' + id,
    method: 'get'
  })
}

//新增委外订单
export function addConsignObj(obj) {
  return request({
    url: '/eims/consign',
    method: 'post',
    data: obj
  })
}

//通过id删除委外订单表
export function delDeliveryObj(id) {
  return request({
    url: '/eims/consign/' + id,
    method: 'delete'
  })
}
//修改委外订单表
export function putConsignObj(obj) {
  return request({
    url: '/eims/consign',
    method: 'put',
    data: obj
  })
}

//  新增委外重订单
export function consignAgainAdd(obj) {
  return request({
    url: '/eims/consign/saveConsignAgain',
    method: 'post',
    data: obj
  })
}

//通过id撤销委外订单
export function cancelConsignById(id) {
  return request({
    url: '/eims/consign/cancelConsign/' + id,
    method: 'get'
  })
}

//  根据委外订单号获取委外订单信息
export function checkConsignDetailByBillId(billId) {
  return request({
    url: '/eims/consign/getConsignByBillId/' + billId,
    method: 'get'
  })
}

export function exportExcel(query) {
  return request({
    url: '/eims/consign/excel',
    method: 'post',
    data: query,
    responseType: 'blob'
  })
}
